package com.sam.cloud.oms.controller;

import com.alibaba.fastjson.JSONObject;
import com.sam.cloud.oms.vo.OrderVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @classname: OrderController
 * @description: TODO
 * @Author: sam
 * @date: 2021/8/8 18:25
 */
@Slf4j
@RestController
public class OrderController {

    @Value("${server.port}")
    private String port;

    @Value("${spring.application.name}")
    private String appName;

    @GetMapping("info")
    public String info(){
        String msg = "I am from "+appName+" port:"+port;
        return msg;
    }

    @PostMapping("save")
    public void save(@RequestBody OrderVo orderVo){
      log.info("order vo:{}", JSONObject.toJSONString(orderVo));
    }
}
